uniform float windowWidth;
uniform float tuftWidth;
uniform float tuftHeight;

varying vec3 texCoord;
void main()
{
	vec4 vertex = gl_Vertex;
	vertex.y+=(1.0-gl_MultiTexCoord0.t)*tuftHeight/1500.0;
	gl_Position = gl_ModelViewProjectionMatrix*vertex;
	texCoord = gl_MultiTexCoord0.stp;
	if(gl_MultiTexCoord0.p >0.0)
		texCoord.s = gl_MultiTexCoord0.s;
	else
		texCoord.s = 1.0-gl_MultiTexCoord0.s;


	gl_Position.x += (gl_MultiTexCoord0.s-0.5)*(tuftWidth)/windowWidth/pow(max(1.0,gl_Position.z),0.5);
}

